<template>
  <div class="ximen">
    <div class="box">
      <public-com></public-com>
      <img src="../assets/wenwu.png" alt="" />
      <h1>{{ build.title }}</h1>
      <p>2017-07-26</p>
      <img :src="build.img" alt="" />
      <p>文物特色</p>
      <p class="build_context">{{ build.context }}</p>
      <footer-com></footer-com>
    </div>
  </div>
</template>

<script>
import PublicCom from "@/components/PublicCom.vue";
import axios from "axios";
import FooterCom from "@/components/FooterCom.vue";
export default {
  components: {
    PublicCom,
    FooterCom,
  },
  data() {
    return {
      build: {},
    };
  },
  watch: {
    $route(to, from) {
      // 路由发生变化页面刷新
      this.$router.go(0);
    },
  },
  methods: {},
  created() {
    axios
      .get("api/Build/getOne.do", {
        params: {
          title: this.$route.query.title,
        },
      })
      .then((result) => {
        console.log(result.data);
        this.build = result.data;
      });
  },
};
</script>

<style scoped>
.box > p {
  margin-top: 20px;
}
.kuang {
  padding: 4px;
  border: 1px solid black;
}
.build_context {
  width: 980px;
  margin: auto;
  text-indent: 2em;
}
</style>
